﻿using DynamicChart.Model;
using Microsoft.EntityFrameworkCore;

namespace DynamicChart.Util;

public class AppDbContext : DbContext
{
    public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
    {
    }

    public DbSet<ActuatorModel> ActuatorModel { get; set; }
    public DbSet<ScreenChartModel> ScreenChartModel { get; set; }
    public DbSet<TableStructureModel> TableStructures { get; set; }
    
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<TableStructureModel>().HasNoKey(); // 无主键
        modelBuilder.Entity<TableStructureModel>().ToView(null); // 不映射真实表
    }
}